const cattles = require("../../sql/cattles");
const sql = require('../../sql/mysql');
const cattlesmoves = require('../../sql/cattlesmove');
module.exports =  (req,res)=>{
  sql.set(cattles, { id: req.fields.id }, { cowshed: req.fields.targetCowshed }).then(() => {
    sql.add(cattlesmoves, req.fields).then(() => {
      res.send({
        code: 0,
        msg: "移动牛舍成功"
      })
    })
  }).catch(() => {
      res.send({
        code: 1,
        msg: "没有找到这条牛的编号"
      })
    })


}